package o;

import android.content.Context;
import androidx.annotation.NonNull;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.gamebox.plugin.gameservice.bean.GameInfo;
import o.bfx.b;

public class bfv {
    private c ˊ;
    private GameInfo ˎ;
    private Context ˏ;

    public interface c {
        void ˏ(int i);
    }

    static class d implements bfy {
        private c ˏ;

        public d(c cVar) {
            this.ˏ = cVar;
        }

        public void ˎ(boolean z) {
            this.ˏ.ˏ(z ? 1 : 0);
        }
    }

    public bfv(@NonNull Context context, @NonNull GameInfo gameInfo) {
        this.ˏ = context;
        this.ˎ = gameInfo;
    }

    public void ˊ(c cVar) {
        if (cVar == null) {
            Logger.ˋ("BuoyNewRedMsgChecker", "check error, CheckNewRedMsgHandler is null");
        } else if (this.ˏ == null || this.ˎ == null) {
            Logger.ˋ("BuoyNewRedMsgChecker", "check error, params is error");
            cVar.ˏ(0);
        } else {
            this.ˊ = cVar;
            if (UserSession.getInstance().isLoginSuccessful()) {
                ॱ();
                return;
            }
            eoj.ˋ().ˎ("BuoyNewRedMsgChecker", new AccountBussinessListener(this) {
                final /* synthetic */ bfv ˊ;

                {
                    this.ˊ = r1;
                }

                public void onAccountBusinessResult(ccp o_ccp) {
                    this.ˊ.ॱ();
                    eoj.ˋ().ˊ("BuoyNewRedMsgChecker");
                }
            });
            bfs.ˋ().ˎ(this.ˏ);
        }
    }

    private void ॱ() {
        ezo ˋ = ezs.ˏ().ˋ(this.ˎ);
        if (ˋ != null) {
            ॱ(ˋ);
            return;
        }
        bfx o_bfx = new bfx(this.ˎ);
        o_bfx.ˎ(new b(this) {
            final /* synthetic */ bfv ˊ;

            {
                this.ˊ = r1;
            }

            public void ˋ(boolean z) {
                if (z) {
                    ezo ˋ = ezs.ˏ().ˋ(this.ˊ.ˎ);
                    if (ˋ != null) {
                        this.ˊ.ॱ(ˋ);
                        return;
                    }
                }
                this.ˊ.ˊ.ˏ(0);
            }
        });
        o_bfx.ˏ();
    }

    private void ॱ(@NonNull ezo o_ezo) {
        if (this.ˊ == null) {
            Logger.e("BuoyNewRedMsgChecker", "handler is null");
        } else if (o_ezo.ʽ()) {
            ˋ(o_ezo, this.ˊ);
        } else {
            Logger.ˎ("BuoyNewRedMsgChecker", "not showByNewNotice");
            this.ˊ.ˏ(0);
        }
    }

    private void ˋ(ezo o_ezo, c cVar) {
        int ʻ = o_ezo.ʻ();
        if (!bfz.ˊ().ॱ(o_ezo)) {
            cVar.ˏ(ʻ);
        } else if (ʻ == 1) {
            cVar.ˏ(ʻ);
        } else {
            bfz.ˊ().ˎ(o_ezo, new d(cVar));
        }
    }
}
